package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.ShoppingCart;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    // 动态条件查询
    List<ShoppingCart> list(ShoppingCart shoppingcart);

    // 修改购物车
//    @AutoFill(OperationType.UPDATE)
    void update(ShoppingCart shoppingcart);

    // 新增购物车
//    @AutoFill(OperationType.INSERT)
    void insert(ShoppingCart shoppingcart);

    // 根据用户id删除全部购物车数据
    @Delete("delete from sky_take_out.shopping_cart where user_id = #{userId}")
    void deleteByUserId(Long userId);

    // 删除购物车数据
    void delete(ShoppingCart shoppingCart);

    // 批量插入购物车数据
    void insertBatch(List<ShoppingCart> shoppingCartList);
}
